Pegasus Pascal v2.1
by Pegasoft of Canada
Designed and Programmed by Ken O. Burtch

What's New (Changes and Fixes since Pegasus Pascal 2.0)

1. Modula-2 order-of-operations now works correctly in all cases.  (This is the
same order as BASIC uses.)  This required some major redesigning of the
pre-compiler.  You can still use PExpr to use Pascal's order.

2. New Exiting Statements: EXIT and RETURN.  RETURN stops a (sub)program and
returns to the caller (like BASIC's or Modula-2's RETURN).  EXIT will leave the
current FOR, REPEAT or WHILE loop. The pre-compiler assumes that there are less
than 9 loops: using EXIT on the 9th loop will cause an error.  (The only way I
found to implement a full EXIT required two-passes over your program: that is,
the compiler would slow down to 1/2 speed.  I thought this was a good
compromise.) Syntax:

  RETURN [IF expr
     [paragraph]]

  EXIT [IF expr
     [paragraph]]

Examples:
    func TypicalMathFunc( x : integer; var j : integer) : boolean
    | This function does some pointless math; returns true if no error
    begin
       TypicalMathFunc = false
       return if x = 0		| leave if x = 0, after writing error message
           WriteLn 'TypicalMathFunc: Can''t divide by 0'
       j = a * 5 / x
       return if j > 0		| leave if j > 0
            j = - j		| else negate j
            TypicalMathFunc = true
     end TypicalMathFunc

   proc MatchWord wd : WordStr; Words: WordArray; NumWords : integer
   | This procedure looks for wd in an array of words; NumWords is the number
   | of words in the array
     var i, j : integer
   begin
      j = 0
      for i = 1..NumWords
          exit if Word = Words[i]
      if j = 0
          WriteLn 'Word was not found'
     else
          WriteLn 'Word is at position ',j,' in Words.' 
   end MatchWord

3. Expressions in CONST statements can now include powers of powers (eg. 1 ** 2
** 3 ), unary operators ( -1, +56, ... ), Trunc4, Round4, and the bit operators
BNot, BAnd, BOr, BXor, >> and <<.  Hex and binary constants are also allowed. 
As before, expressions must not start with an identifier.

Example:
   program
      const myconst1 = bnot ( ( $EA0 band $7F) bor %00000011 )
                 myconst2 = +trunc4( 13.5)


Squash those Bugs! Speed up that Compiler!

1. INC/DEC has two fixes.  There are no longer ORCA/Pascal errors with a comment
on an INC/DEC, and they now work with increments like 1+1 (eg. DEC i,1+1 equals
i = i - (1+1), not the incorrect i = i - 1+1. ).

2. Some of the compiler's key procedures (specifically, the output and some of
the scope-checking procedures) were converted from Pascal to about 1000 lines of
assembly language.  Your programs will pre-compile up 60% faster (depending on
your program [the fine print]).  The biggest improvements are when pre-compiling
data declarations like VAR, TYPE, and CONST.  On average, pre-compiles should be
10%-20% faster.

3. Global declarations in units after the "Implementation" line are no longer
treated as before the "Implementation".  (I don't know how I missed this MAJOR
bug when testing version 2.0.)

4. Pragma errors should now abort compiling: before, PP would compile the rest
of the program anyway.  Also, no longer crashes after certain pragma macro
errors.

5. If you are creating a listing, the status graph no longer appears in the
listing!  (The status graph is written to the console.) This may look annoying
if you are printing the listing on the screen, but it doesn't obscure the lines.
*** Also, the computer no longer crashes when listing certain programs.  It
turned out to be a bug in ORCA/Pascal: don't include a COPY or CONCAT as a
parameter to a Write or WriteLn!

6. from 'path' changes:  From '../path' uses (moving up a subdirectory/
subdirectories) has been added.  The path problem of a From 'path2' uses after a
From 'path1' uses should be fixed.


Changes to PPLib

1. Strings now has a Tab procedure that moves the cursor to a specific screen
column (1..80), like Applesoft's Tab.


Known Bugs:

1. Listings can crash.  I've spent DAYS trying to track this down, with no
results.  (If I recompile the language, the listings work fine UNTIL I leave the
ORCA shell.  When I return, the listings crash again. Anyone have any ideas?)

KEN: Remember that scanner.pas may have to be freshly recompiled if macro errors
creep in (ie on 2 consecutive compiles we get mac errors).  ORCA/P can
introduces the errors.

